$(document).ready(function () {


    /*
     * GESTION DE LA LANGUE
     */
    
    var arrayLang = ['FR-fr', 'EN-en', 'ES-es', 'DE-de'];
    var lang;
    var url = $(location).attr('href');
    var substr = url.split('/');
    $.each(substr, function(i){
        var index = $.inArray(substr[i], arrayLang);
        if(index >= 0)
            lang = arrayLang[index];
    });
    $(".lang ul").hide();
    $(".lang_button").click(function(e){
        e.preventDefault(e);
        if($(".lang ul").is(":visible"))
            $(".lang ul").slideUp();
        else
            $(".lang ul").slideDown();
    });
    $(".current_lang").addClass(lang);
    $(".lang li."+lang).hide();
    
    /*
     * GESTION MENU
     */
    var isHoverMenu;
    $('#protoss_head_btn').hover(function(){
        if(isHoverMenu === 1)
        {
            $('#protoss_menu').show();
        }
        else{
            $('#protoss_menu').fadeIn('slow');
        }
        $('#protoss_head_btn').addClass('selected_race');
        $('#zerg_head_btn').removeClass('selected_race');
        $('#terran_head_btn').removeClass('selected_race');
       
    }, function(){
        $('#protoss_menu').hide();
    });
    
    $('#zerg_head_btn').hover(function(){
        if(isHoverMenu === 1)
        {
            $('#zerg_menu').show();
        }
        else{
            $('#zerg_menu').fadeIn('slow');
        }
        $('#protoss_head_btn').removeClass('selected_race');
        $('#zerg_head_btn').addClass('selected_race');
        $('#terran_head_btn').removeClass('selected_race');
    }, function(){
       
       
        $('#zerg_menu').hide();
    });
    
    $('#terran_head_btn').hover(function(){
        if(isHoverMenu === 1)
        {
            $('#terran_menu').show();
        }
        else{
            $('#terran_menu').fadeIn('slow');
        }
        $('#protoss_head_btn').removeClass('selected_race');
        $('#zerg_head_btn').removeClass('selected_race');
        $('#terran_head_btn').addClass('selected_race');
    }, function(){
        $('#terran_menu').hide();
    });
    
    $('#menu').hover(function(){
        isHoverMenu = 1;
    }, function(){
        isHoverMenu = 0;
         $('#protoss_head_btn').removeClass('selected_race');
        $('#zerg_head_btn').removeClass('selected_race');
        $('#terran_head_btn').removeClass('selected_race');
    });
    
    
});